


CFLAGS += -O2 -DLINUX -D_GNU_SOURCE -Wall -DDEBUG 
SOURCE_CLIENT = client/session-mng.c  client/session-test.c common/udp-client.c common/tun.c common/hash.c common/hashmap.c common/session-order.c common/buff.c common/ring.c common/util.c
OBJS_CLIENT = $(SOURCE_CLIENT:.c=.o)
SOURCE_SERVER = server/udp-server.c server/session-server.c common/session-order.c common/tun.c common/buff.c common/ring.c common/udp-client.c  common/hashmap.c common/hash.c common/util.c
OBJS_SERVER = $(SOURCE_SERVER:.c=.o)
SERVER_INCDIR = ./common -I./server 
CLIENT_INCDIR = ./common -I./client 
CLIENT_BINARY = muti-udp-client
SERVER_BINARY = muti-udp-server

all: $(CLIENT_BINARY) $(SERVER_BINARY)

$(CLIENT_BINARY): $(OBJS_CLIENT)
	$(CC) $(CFLAGS) $^ $(LDFLAGS)  -lpthread -o $@

$(SERVER_BINARY): $(OBJS_SERVER)
	$(CC) $(CFLAGS) $^ $(LDFLAGS)  -lpthread  -o $@
	
$(OBJS_CLIENT): %.o : %.c
	$(CC) $(CFLAGS) -DCLIENTS_USED -O2 -I$(CLIENT_INCDIR) -c $< -o $@ 
	
$(OBJS_SERVER): %.o : %.c
	$(CC) $(CFLAGS) -DSERVER_USED  -O2 -I$(SERVER_INCDIR) -c $< -o $@ 
clean:
	rm -rf common/*.o
	rm -rf server/*.o
	rm -rf client/*.o
	rm -rf $(CLIENT_BINARY) $(SERVER_BINARY)

#	$(ROMFSINST) gcom /etc_ro/gcom




